[dynamic] Different behaviours between .NET 4.0 beta 2 and last release of .NET 4.0 !

Posted by yogi4ever on Stack Overflow See other posts from Stack Overflow or by yogi4ever
Published on 2010-06-08T18:19:46Z Indexed on 2010/06/08 18:22 UTC
Read the original article Hit count: 193

Filed under:
|
|
|
|

Hi.

I've identified a difference of DLR between .NET 4.0 Beta 2 and the last release of .NET 4.0.

In .NET 4.0 Beta 2, this code perfectly works at runtime :

var dateTimeList = new List();

dynamic myDynamicObject = dateTimeList;

object value = DateTime.Now;

myDynamicObject.Add(value);

Now, with last release of .NET 4.0, I have an exception at run time (to solve myDynamicObject.Add(value);) :-(

In my real code, 'myDynamicObject' is a dynamic (but I know that it is always an ObservableCollection where T can be anything). 'value' is an instance which was got by some reflexions. As 'value' can have any type, the type of 'value' is Object.

Do you see how can I solve this new limitation of .NET 4.0 ?

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET